package com.example.tkserver.controller;

import com.example.tkserver.entity.MyMessage;
import com.example.tkserver.service.interfaces.MainService;
import com.example.tkserver.service.interfaces.RabbitMQService;
import com.example.tkserver.service.interfaces.SignInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * LiZhuoYi:
 * Date:2022/9/24
 */
@RestController()
public class MainController {
    @Autowired
    SignInService signInService;
    @Autowired
    RabbitMQService rabbitMQService;
    @Autowired
    MainService mainServicel;
    @RequestMapping("/test")
    public String test(){
        MyMessage message = new MyMessage();
        message.setSid(-1);
        message.setRid(1);
        message.setTime(System.currentTimeMillis()/1000);
        message.setTitle("感谢使用泰科掌上宝");
        message.setAvatar("https://www.tkzsbserver.work/resources/offical_head.png");
        message.setNote("oh~亲爱的同学~终于等到你了~");
        return rabbitMQService.sendMsg(message);
    }

    @RequestMapping(value="/getNotice")
    public Object getNotice(){
        return mainServicel.getNotice();
    }

    @RequestMapping(value="/getSwiper")
    public List<String> getSwiper(){
        return mainServicel.getSwiper();
    }

    @RequestMapping("/signIn")
    public int signIn(int uid){
        return signInService.signIn(uid);
    }
}
